package com.bootdo.xiao.suggest;

/**
 * @Auther: liuj
 * @Date: 2019/6/17 16:01
 * @Description:建议35：避免在构造函数中初始化其他类
 */
public class Suggest35 {
    public static void main(String[] args){
        Father son = new Son();
        ((Son) son).something();
        //内存溢出 死锁
    }
}

class Father{
    public Father(){
        new Other();
    }
}

class Son extends Father{
    public void something(){
        System.out.println("son");
    }
}

class Other{
    Other(){
        new Son();
    }
}